home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / AppleScript / Development Tools / Interfaces / AppleScript 1.0 Interfaces / CIncludes / AppleScript.h < prev    next >
Encoding:
Text File  |  1993-04-08  |  5.8 KB  |  157 lines  |  [TEXT/MPS ]

  1. ////////////////////////////////////////////////////////////////////////////////
  2. // OPEN SCRIPTING ARCHITECTURE: AppleScript Specific Interface
  3. ////////////////////////////////////////////////////////////////////////////////
  4. // Copyright © 1992 Apple Computer, Inc. All rights reserved.
  5. // Authors: William Cook, Donn Denman, and Warren Harris
  6. ////////////////////////////////////////////////////////////////////////////////
  7.  
  8. #ifndef __APPLESCRIPT__
  9. #define __APPLESCRIPT__
  10.  
  11. #ifndef __OSA__
  12. #include "OSA.h"
  13. #endif
  14. #ifndef __TEXTEDIT__
  15. #include "TextEdit.h"
  16. #endif
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21.  
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // Types and Constants
  24. ////////////////////////////////////////////////////////////////////////////////
  25.  
  26. #define typeAppleScript                    'ascr'
  27.  
  28. #define kAppleScriptSubtype                typeAppleScript
  29.     // The specific type for the AppleScript instance of the
  30.     // Open Scripting Architecture type.
  31.  
  32. #define typeASStorage                    typeAppleScript
  33.  
  34. ////////////////////////////////////////////////////////////////////////////////
  35. // Script Error Codes
  36. ////////////////////////////////////////////////////////////////////////////////
  37.  
  38. // Runtime errors:
  39. #define errASCantConsiderAndIgnore        -2720
  40. #define errASCantCompareMoreThan32k        -2721
  41.     
  42. // Parser/Compiler errors:
  43. #define errASTerminologyNestingTooDeep    -2760
  44. #define errASIllegalFormalParameter        -2761
  45. #define errASParameterNotForEvent        -2762
  46. #define errASNoResultReturned            -2763
  47.  
  48. // Dialect specific script errors:
  49. // The range -2780 thru -2799 is reserved for dialect specific error codes.
  50. // (Error codes from different dialects may overlap.)
  51.  
  52. // English errors:
  53. #define errASInconsistentNames            -2780
  54.  
  55. ////////////////////////////////////////////////////////////////////////////////
  56. // Component Selectors
  57. ////////////////////////////////////////////////////////////////////////////////
  58.  
  59. #define    kASSelectInit                    0x1001
  60. #define    kASSelectSetSourceStyles        0x1002
  61. #define    kASSelectGetSourceStyles        0x1003
  62. #define    kASSelectGetSourceStyleNames    0x1004
  63.  
  64. ////////////////////////////////////////////////////////////////////////////////
  65. // OSAGetScriptInfo Selectors
  66. ////////////////////////////////////////////////////////////////////////////////
  67.  
  68. #define kASHasOpenHandler                'hsod'
  69.     // This selector is used to query a context as to whether it contains
  70.     // a handler for the kAEOpenDocuments event. This allows "applets" to be 
  71.     // distinguished from "droplets."  OSAGetScriptInfo returns false if
  72.     // there is no kAEOpenDocuments handler, and returns the error value 
  73.     // errOSAInvalidAccess if the input is not a context.
  74.  
  75. ////////////////////////////////////////////////////////////////////////////////
  76. // Initialization
  77. ////////////////////////////////////////////////////////////////////////////////
  78.  
  79. pascal OSAError
  80. ASInit(ComponentInstance    scriptingComponent,
  81.        long                    modeFlags,
  82.        long                    minStackSize,
  83.        long                    preferredStackSize,
  84.        long                    maxStackSize,
  85.        long                    minHeapSize,
  86.        long                    preferredHeapSize,
  87.        long                    maxHeapSize)
  88.     = ComponentCallNow(kASSelectInit, 28);
  89.     // This call can be used to explicitly initialize AppleScript.  If it is
  90.     // not called, the a scripting size resource is looked for and used. If
  91.     // there is no scripting size resource, then the constants listed below
  92.     // are used.  If at any stage (the init call, the size resource, the 
  93.     // defaults) any of these parameters are zero, then parameters from the
  94.     // next stage are used.  ModeFlags are not currently used.
  95.     // Errors:
  96.     //    errOSASystemError        initialization failed
  97.  
  98. // These values will be used if ASInit is not called explicitly, or if any
  99. // of ASInit's parameters are zero:
  100. #define kASDefaultMinStackSize                    ( 4 * 1024)
  101. #define kASDefaultPreferredStackSize            (16 * 1024)
  102. #define kASDefaultMaxStackSize                    (16 * 1024)
  103. #define kASDefaultMinHeapSize                    ( 4 * 1024)
  104. #define kASDefaultPreferredHeapSize                (16 * 1024)
  105. #define kASDefaultMaxHeapSize                    (32 * 1024 * 1024)
  106.  
  107. ////////////////////////////////////////////////////////////////////////////////
  108. // Source Styles
  109. ////////////////////////////////////////////////////////////////////////////////
  110.  
  111. pascal OSAError
  112. ASSetSourceStyles(ComponentInstance    scriptingComponent,
  113.                   STHandle            sourceStyles)
  114.     = ComponentCallNow(kASSelectSetSourceStyles, 4);
  115.     // Errors:
  116.     //    errOSASystemError        operation failed
  117.  
  118. pascal OSAError
  119. ASGetSourceStyles(ComponentInstance    scriptingComponent,
  120.                   STHandle*            resultingSourceStyles)
  121.     = ComponentCallNow(kASSelectGetSourceStyles, 4);
  122.     // Errors:
  123.     //    errOSASystemError        operation failed
  124.  
  125. pascal OSAError
  126. ASGetSourceStyleNames(ComponentInstance    scriptingComponent,
  127.                       long                modeFlags,
  128.                       AEDescList*        resultingSourceStyleNamesList)
  129.     = ComponentCallNow(kASSelectGetSourceStyleNames, 8);
  130.     // This call returns an AEList of styled text descriptors the names of the
  131.     // source styles in the current dialect.  The order of the names corresponds
  132.     // to the order of the source style constants, below.  The style of each
  133.     // name is the same as the styles returned by ASGetSourceStyles.
  134.     // 
  135.     // Errors:
  136.     //    errOSASystemError        operation failed
  137.  
  138. // Elements of STHandle correspond to following categories of tokens, and
  139. // accessed through following index constants:
  140. #define kASSourceStyleUncompiledText            0
  141. #define kASSourceStyleNormalText                1
  142. #define kASSourceStyleLanguageKeyword            2
  143. #define kASSourceStyleApplicationKeyword        3
  144. #define kASSourceStyleComment                    4
  145. #define kASSourceStyleLiteral                    5
  146. #define kASSourceStyleUserSymbol                6
  147. #define kASSourceStyleObjectSpecifier            7
  148. #define kASNumberOfSourceStyles                    8
  149.  
  150. ////////////////////////////////////////////////////////////////////////////////
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. // You're still here?  Go home.
  155. #endif
  156. //////////////////////////////////////////////////////////////////////////////////////////////////////
  157.